<?php
/**
 * Yabsta News
 *
 * News list view file
 * 
 * This file is a subject under proprietary sofrware license
 * 
 * @category
 * @package
 * @subpackage
 * @author      valerii lazarevych <lazarevuch@gmail.com>
 * @copyright   Copyright(c) Valerii Lazarevych
 * @license     proprietary software license
 * @version     $Id: News.php 29.05.2012 15:20:05 valerii $
 */

/**
 * News domainObject class
 * 
 * Represent OOP News entity 
 * with this hold functionals to working with news data
 */
class   domainObjects_News        extends     domainObject
{
    /**
     * News title
     * 
     * @var string
     */
    public      $title             =       null;
           
    /**
     * News Body
     * 
     * @var string
     */
    public      $body       =       null;    
    
    /**
     * News tags
     * 
     * @var string  |   url
     */
    public      $tags       =       null;                     
    
    /**
     * Get news title
     * 
     * @return string
     */
    public function newsTitle()
    {
        if (!$this->title)            
             $this->title    =   implode(' ', array_slice( str_word_count($this->newsBody(), '2'), 0, 3 ) );
        
        return html_entity_decode($this->title);
    }        
    
    /**
     * Get news full message
     * 
     * @return string
     */
    public function newsBody()
    {
        if (!$this->body)
             $this->body     =   $this->title ? $this->title : '';
        
        return html_entity_decode($this->body);
    }
    
    /**
     * Get news tags
     * 
     * @return string 
     */
    public function newsTags()
    {
        return $this->tags;
    }                
}
